// f泛型在类中的应用
// class Collection {
//   data: number[] = []
//   public push(...items: number[]) {
//     this.data.push(...items)
//   }

//   public shift(): number {
//     return this.data.shift() as number
//   }

// }

// const numberCollection = new Collection()
// numberCollection.push(1, 2, 3, 4, 5)

// console.log(numberCollection.shift());



// f泛型在类中的应用
class Collection<T> {
  data: T[] = []
  public push(...items: T[]) {
    this.data.push(...items)
  }

  public shift(): T {
    return this.data.shift() as T
  }

}

const numberCollection = new Collection<number>()
numberCollection.push(111, 2, 3, 4, 5)

console.log(numberCollection.shift());
